package UserFactory;

public class Test {
    public static void main(String[] args) {

        // 工厂模式
        UserFactory adminFactory = new AdminFactory();
        User admin = adminFactory.creatUser("唐僧",100);

        UserFactory normalFactory = new NormalFactory();
        User normal1 = normalFactory.creatUser("悟空",1000);

        UserFactory normalFactory2 = new NormalFactory();
        User normal2 = normalFactory2.creatUser("八戒",800);

        // 代理模式
        ProxyUser proxyUserAdmin = new ProxyUser(admin);
        proxyUserAdmin.addBook("西游记");

        ProxyUser proxyUserNormal1 = new ProxyUser(normal1);
        proxyUserNormal1.borrowBook("西游记");

        ProxyUser proxyUserNormal2 = new ProxyUser(normal2);
        proxyUserNormal2.borrowBook("西游记");

    }

    public static void main1(String[] args) {
        AdminUser adminUser = new AdminUser("唐僧",100);
        adminUser.menu();

        NormalUser normalUser1 = new NormalUser("孙悟空",1000);
        normalUser1.menu();

        NormalUser normalUser2 = new NormalUser("八戒", 800);
        normalUser2.menu();
    }
}

